<template>
	<view class="content">
		<u-image width="100%" height="360rpx" borderRadius="10" :src="getImage(0)"></u-image>
		<view class="b_c">
			<view class="b_c_t">
				{{info.prModel}}
			</view>
			<!-- 金额 -->
			<view class="b_j">
				<view class="b_j_l">
					<view class="b_j_l_d">
						￥
					</view>
					<view class="b_j_l_t">
						{{info.prPrice}}
					</view>
				</view>
				<view class="b_j_r">
					销量：{{info.prQuantity}}
				</view>
			</view>
			<!-- 简介 -->
			<view class="b_jj">
				{{info.remark}}
			</view>
		</view>
		<u-tabs :list="list" :current="current" @change="change" bar-height="2" bar-width="80" :item-width="230"
			active-color="#fff"></u-tabs>
		<view class="b_i_i">
			<image @click="perImage" class="b_i" :src="getImage()" mode="aspectFit"></image>
		</view>

	</view>
</template>

<script>
	import {
		getInfoData
	} from "@/common/api.js"
	import {
		url
	} from "@/common/index.js"
	export default {
		data() {
			return {
				info: {},
				list: [{
						name: '商品详情'
					},
					{
						name: '施工效果'
					},
					{
						name: '交车案例'
					}
				],
				current: 0,
			}
		},
		onLoad(data) {
			getInfoData(data.item).then(res => {
				this.info = res.data
			})

		},
		methods: {
			change(index) {
				this.current = index
			},
			perImage() {
				let url = this.current == 0 ? this.info.prDetail : this.current == 1 ? this.info.prResult : this.info.prCase
				uni.previewImage({
					urls: [
						url
					],
					success: res => {
						console.log(res);
					}
				})
			},
			getImage(type) {
				if (type == 0) return url + this.info.prDetail
				if (this.current == 0) return url + this.info.prParticulars
				if (this.current == 1) return url + this.info.prResult
				if (this.current == 2) return url + this.info.prCase
			}
		}
	}
</script>

<style>
	page {
		background-color: #222;
	}

	.content {
		padding: 30rpx;
	}

	.b_c {
		width: 100%;
		border-radius: 15rpx;
		padding: 15rpx 0;
		margin: 30rpx 0;
	}

	.b_j {
		margin-top: 15rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.b_j_l {
		display: flex;
		color: red;
	}

	.b_j_l_d {
		font-weight: 700;
		line-height: 60rpx;
	}

	.b_j_l_t {
		font-size: 40rpx;
	}

	.b_j_r {
		color: #cccccc;
	}

	.b_c_t {
		font-size: 30rpx;
		font-weight: 550;
	}

	/* 简介 */
	.b_jj {
		width: 100%;
		min-height: 200rpx;
		border-radius: 15rpx;
		background-color: #7a7a7a;
		max-height: 200rpx;
		font-size: 28rpx;
		color: #fff;
		padding: 10rpx;
	}

	.b_i_i {
		width: 100%;
		margin: 0 auto;
		display: flex;
		justify-content: center;
	}

	.b_i {
		width: 690rpx;
	}
</style>